﻿/*
 * This file is part of MonoSettlers.
 *
 * Copyright (C) 2010-2011 Christoph Husse
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as
 *  published by the Free Software Foundation, either version 3 of the
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authors: 
 *      # Christoph Husse
 * 
 * Also checkout our homepage: http://opensettlers.codeplex.com/
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenTK;
using System.Xml.Serialization;

namespace MonoSettlers
{
    [Serializable]
    public enum StackDirection
    {
        Incoming,
        Outgoing,
    }

    [Serializable]
    public class ResourceStackConfig
    {
        [XmlIgnore]
        public Vector2d DoublePosition { get; set; }
        [XmlAttribute]
        public Resource Type { get; set; }
        [XmlAttribute]
        public Int32 TimeOffset { get; set; }
        [XmlAttribute]
        public Int32 CycleCount { get; set; }
        [XmlAttribute]
        public Int32 MaxStackSize { get; set; }
        [XmlAttribute]
        public Int32 QualityIndex { get; set; }
        [XmlAttribute]
        public StackDirection Direction { get; set; }
    }

    [Serializable]
    public class BuildingConfig
    {
        [XmlAttribute]
        public Int32 TypeIndex { get; set; }
        [XmlAttribute]
        public Int32 SettlerCount { get; set; }
        [XmlAttribute]
        public String Name { get; set; }
        [XmlAttribute]
        public String AnimationClass { get; set; }
        [XmlAttribute]
        public Boolean NoProductionRange { get; set; }
        public List<ResourceStackConfig> ResourceStacks { get; set; }
        [XmlAttribute]
        public Int32 DamageResistance { get; set; }
        [XmlAttribute]
        public Int32 WoodCount { get; set; }
        [XmlAttribute]
        public Int32 StoneCount { get; set; }
        [XmlAttribute]
        public Int32 ProductionTimeMillis { get; set; }
        [XmlAttribute]
        public int VisualWidth { get; set; }
        [XmlAttribute]
        public int VisualHeight { get; set; }

        // non-serialized fields
        [XmlIgnore]
        public List<Rectangle> SolidBoundaries { get; set; }
        [XmlIgnore]
        public Rectangle LockedBounds { get; set; }
        [XmlIgnore]
        public Int32 GridWidth { get; set; }
        [XmlIgnore]
        public Int32 GridHeight { get; set; }

        public BuildingConfig()
        {
            ResourceStacks = new List<ResourceStackConfig>();
            SolidBoundaries = new List<Rectangle>();
        }
    }

    [XmlRoot("RaceConfig")]
    public partial class RaceConfig
    {
        public List<BuildingConfig> Buildables {get; set;}
    }
}
